/**
 * 
 */
package com.cosmetics.groupware.util;

import java.io.Reader;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

/**
 * description :
 * @author     : dreams
 * @Date       : 2011. 7. 25.
 * @Version    :   
 * <pre>
 * com.cosmetics.groupware.util |_ SqlSessionFactoryManager.java
 * </pre>
 */
public class SqlSessionFactoryManager {
	private static final SqlSessionFactory sqlSessionFactory;
	static {
		try {
			String resource = "SqlSessionConfig.xml";
			Reader reader = Resources.getResourceAsReader(resource);
			sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
		} catch (Exception e){
			e.printStackTrace();
			throw new RuntimeException(e);
		}
	}
	
	public SqlSessionFactoryManager() {}
	
	public static SqlSessionFactory getSqlMapper() {
		return sqlSessionFactory;
	}
	
}
